package com.ebelter.ty.ui.activity;


import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import com.ebelter.ty.R;
import com.ebelter.ty.ui.fragment.scale.others.Scale_ABOUT_Fragment;
import com.ebelter.ty.ui.fragment.scale.others.Scale_M_BIRTHDAY_Fragment;
import com.ebelter.ty.ui.fragment.scale.others.Scale_M_HEIGHT_Fragment;
import com.ebelter.ty.ui.fragment.scale.others.Scale_M_NAME_Fragment;

public class FragmentsActivity extends TyBaseActivity {


    public static final String openWhichFragment = "1";
    public static final int SCALE_ABOUT = 1;
    public static final int SCALE_M_NAME = 2;
    public static final int SCALE_M_HEIGHT = 3;
    public static final int SCALE_M_BIRTHDAY = 4;
    public static final int SCALE_M_PSW = 5;
    public static final int SCALE_M_MANGERDEVICE = 6;




    @Override
    protected int loadLayoutById() {
        return R.layout.activity_fragments;
    }

    @Override
    protected void initData() {
        int openWhichF = getIntent().getIntExtra(openWhichFragment,-1);
        Fragment fragment = null;
        if (openWhichF == SCALE_ABOUT){
            fragment = new Scale_ABOUT_Fragment();
        }else if (openWhichF == SCALE_M_NAME){
            fragment = new Scale_M_NAME_Fragment();
        }else if (openWhichF == SCALE_M_HEIGHT){
            fragment = new Scale_M_HEIGHT_Fragment();
        }else if (openWhichF == SCALE_M_BIRTHDAY){
            fragment = new Scale_M_BIRTHDAY_Fragment();
        }else if (openWhichF == SCALE_M_PSW){

        }else if (openWhichF == SCALE_M_MANGERDEVICE){

        }else {
            finish();
        }

        FragmentManager fm = getSupportFragmentManager();
        FragmentTransaction transaction = fm.beginTransaction();
        transaction.add(R.id.fragmentactivity_contain, fragment);
        transaction.commit();
    }
}
